<div class="bg-light lter b-b wrapper-md ng-scope">
    <h4 class="m-n font-thin">添加会员储值规则</h4>
    <button ui-sref="app.memberCharge" class="btn-back btn btn-dark btn-sm btn-rounded">
        返回
    </button>
</div>
<div class="wrapper-md ng-scope" ng-controller="chargeRuleAddCtrl">
    <div class="panel-body panel panel-default no-border b-l b-r b-b">
        <div class="bg-light panel-body">
            <div class="m-b-xs">
                <p class="m-n h4 font-bold">会员储值规则</p>
            </div>
        </div>
        <div class="panel-default panel-body">
            <form name="chargeInfo" class="form-horizontal form-validation" ng-submit="addRule()">
                <div class="form-group">
                    <label class="col-sm-2 control-label font-bold">储值金额</label>
                    <div class="col-sm-5">
                        <input type="number" name="balanceMoney" min="0.01" step="0.01" ng-model="chargeRuleVO.balanceMoney"
                               ng-pattern="/^[0-9]+(.[0-9]{1,2})?$/" class="form-control" placeholder="请输入储值金额" required>
                    </div>
                    <div class="form-text" ng-if="chargeInfo.balanceMoney.$touched">
                        <span class="text-danger" ng-if="chargeInfo.balanceMoney.$error.pattern">(最多保留两位小数)</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label font-bold">营销活动</label>
                    <div class="col-sm-5">
                        <div class="m-b-xs">
                            <label class="i-checks i-checks-sm m-b-none h6">
                                <input type="checkbox" ng-checked=" chargeRuleVO.isGiveCoupons==1" ng-click=" chargeRuleVO.isGiveCoupons= chargeRuleVO.isGiveCoupons==1?0:1;"><i></i>
                            </label>
                            <p class="inline m-t-sm m-r-xs">开卡赠送优惠卷</p>
                            <div class="inline" ng-if=" chargeRuleVO.isGiveCoupons==1">
                                <select class="form-control w-sm inline m-r-xs" name="coupons" ng-model="chargeRuleVO.giveCouponsId" required>
                                    <option value="">请选择优惠卷</option>
                                    <option ng-repeat="c in couponsList" value="{{c.id}}" >{{c.name}}</option>
                                </select>
                            </div>
                            <div class="block">
                                <div class="form-text" ng-if="chargeInfo.coupons.$touched">
                                    <span class="text-danger" ng-if="chargeInfo.coupons.$error.required">(请您选择赠送的优惠券)</span>
                                </div>
                            </div>
                        </div>
                        <div class="m-b-xs">
                            <div class="inline">
                                <label class="i-checks i-checks-sm m-b-none h6">
                                    <input type="checkbox" ng-checked="chargeRuleVO.isGiveIntegral==1" ng-click="chargeRuleVO.isGiveIntegral=chargeRuleVO.isGiveIntegral==1?0:1;"><i></i>
                                </label>
                                <p class="inline m-t-sm m-r-xs">赠送积分</p>
                            </div>
                            <div class="inline" ng-if=" chargeRuleVO.isGiveIntegral==1">
                                <input type="number" min="1" class="inline w-xs form-control m-r-xs" name="integral" ng-model=" chargeRuleVO.giveIntegral" required>
                                <p class="inline m-n">分</p>
                            </div>
                            <div class="form-text" ng-if="chargeInfo.integral.$touched">
                                <span class="text-danger" ng-if="chargeInfo.integral.$error.required">(赠送积分是必须填的)</span>
                            </div>
                        </div>
                        <div class="m-b-xs">
                            <div class="inline">
                                <label class="i-checks i-checks-sm m-b-none h6">
                                    <input type="checkbox" ng-checked=" chargeRuleVO.isGiveMoney==1" ng-click=" chargeRuleVO.isGiveMoney= chargeRuleVO.isGiveMoney==1?0:1;"><i></i>
                                </label>
                                <p class="inline m-t-sm m-r-xs">赠送金额</p>
                            </div>
                            <div class="inline" ng-if=" chargeRuleVO.isGiveMoney==1">
                                <input type="number" min="0.01" step="0.01" class="inline w-xs form-control m-r-xs" name="money"
                                       ng-pattern="/^[0-9]+(.[0-9]{1,2})?$/" ng-model="chargeRuleVO.giveMoney" required>
                                <p class="inline m-n">元</p>
                            </div>
                            <div class="form-text" ng-if="chargeInfo.money.$touched">
                                <span class="text-danger" ng-if="chargeInfo.money.$error.required">(赠送金额是必须填的)</span>
                                <span class="text-danger" ng-if="chargeInfo.money.$error.pattern">(最多保留两位小数)</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="line line-dashed b-b line-lg pull-in"></div>
                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-2">
                        <button type="submit" class="btn btn-success" ng-disabled="chargeInfo.$invalid">保存</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>